Implement declare decimal-format for XQuery 3.1#6217
Open
joewiz wants to merge 2 commits intoeXist-db:developfrom
Open
Implement declare decimal-format for XQuery 3.1#6217joewiz wants to merge 2 commits intoeXist-db:developfrom
declare decimal-format for XQuery 3.1#6217joewiz wants to merge 2 commits intoeXist-db:developfrom
Conversation
5 tasks
Add parser support for the XQuery 3.1 `declare decimal-format` and `declare default decimal-format` prolog declarations (spec section 4.10), enabling users to customize number formatting via fn:format-number. The runtime infrastructure (DecimalFormat class, XQueryContext storage, FnFormatNumbers 3-arg support) was already in place — this adds the missing parser recognition and tree walker processing. Changes: - XQuery.g: Add DECIMAL_FORMAT_DECL/DEF_DECIMAL_FORMAT_DECL tokens, grammar rules for named and default forms, property keywords - XQueryTree.g: Walk AST, validate properties (single-char, zero-digit, distinctness), register formats in XQueryContext - ErrorCodes.java: Add XQST0097 (duplicate) and XQST0098 (invalid) - XQueryContext.java: Add setDefaultStaticDecimalFormat() convenience - format-numbers.xql: Add tests for named/default formats, custom NaN/infinity, and error cases Closes eXist-db#56 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dd Javadoc Rename the three decimal-format validation helper methods in XQueryTree.g with a `df` prefix to clarify their scope: - requireSingleChar → dfRequireSingleChar - validateZeroDigit → dfValidateZeroDigit - validateDistinctPictureChars → dfValidateDistinctPictureChars Add Javadoc comments on DecimalFormat.UNNAMED and UNNAMED_DECIMAL_FORMAT explaining the XPath 3.1 spec origin of the "unnamed" terminology. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c4344b7 to
8febcfd
Compare
Member
|
@joewiz what is needed for this PR to be ready? |
Member
Author
|
[This response was co-authored with Claude Code. -Joe] CI state: 5/9 checks pass. Of the 4 failures:
Dependencies: Wave 3. Must merge after For full context on all 7.0 PRs and the merge order, see the Reviewer Guide. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
declare decimal-formatanddeclare default decimal-formatprolog declarations per XQuery 3.1. Addresses review comments from @line-o on PR #6077.Note: This branch is based on the merged grammar (requires v2/w3c-xquery-update-3.0 + v2/xqft-phase2 + v2/xquery-4.0-parser to be merged first).
Spec References
Tests
Supersedes
Test plan
🤖 Generated with Claude Code